<div class="content">
	<div id="left-column">
		<?php echo $this->element('admin_left_column')?>		
	</div>
	<div class="right-store-column">

				<div class="storeProducts">
					<h2><?php __d('store','Store Products');?></h2>				
					<table class="index" cellpadding="0" cellspacing="0">
					<tr>
							<th>&nbsp;</th>
							<th><?php echo __('Offer Type',true);?></th>
							<th><?php echo $this->Paginator->sort('name');?></th>
							<th><?php echo $this->Paginator->sort('price_detaliczna');?></th>
							<?php if($session->check('Auth.User.id')){?><th class="actions"><?php __d('store','Actions');?></th><?php }?>
					</tr>
					<?php
					$i = 0;
					foreach ($storeProducts as $storeProduct):
						$class = null;
						if ($i++ % 2 == 0) {
							$class = ' class="altrow"';
						}
					?>
					<tr<?php echo $class;?>>
						<td>
							<?php echo $this->Html->link($fileUpload->image($storeProduct['StoreUpload']['name'],array('autoResize'=>true,'width'=>100,'imagePathOnly'=>false))
								, array('action' => 'view', $storeProduct['StoreProduct']['id']),array('escape'=>false)); ?>&nbsp;
						</td>
						<td>
							<?php 
								if(isset($storeProduct['StoreModel']) && is_array($storeProduct['StoreModel'])){
									foreach ($storeProduct['StoreModel'] as $key_model => $model) {
										echo $model['name'].'<br/>';
									}
								}
							?>&nbsp;
						</td>				
						<td><?php echo $storeProduct['StoreProduct']['name']; ?>&nbsp;</td>
						<td align="right">
							<?php if($storeProduct['StoreProduct']['price_przecena'] > 0 && $storeProduct['StoreProduct']['price_promocja'] == 0){?>
									<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],2,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'] );?></span> 
									<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_przecena'],2,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							 
							<?php }else if( $storeProduct['StoreProduct']['price_promocja'] > 0){?>
									<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],2,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange']);?></span> 
									<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_promocja'],2,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							
							<?php }else{?>
									<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],2,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span>
							<?php }?>					
						</td>
						<?php if($session->check('Auth.User.id')){?>
						<td class="actions">
							<?php echo $html->link($html->image('firma/actions_16_edit.png',array('title'=>__d("store","View",true))), 
						        array('plugin'=>'store','controller'=>'products','action'=>'edit',$storeProduct['StoreProduct']['id']),
						        array('escape'=>false,'class'=>'','rel'=>"prettyPhoto[iframe]")); ?>
							<?php echo $this->Html->link($html->image('firma/actions_16_delete.png',array('title'=>__d("store","View",true))), array('plugin'=>'store','controller'=>'products','action'=>'delete', $storeProduct['StoreProduct']['id']), array('escape'=>false), sprintf(__d('store','Are you sure you want to delete # %s?', true), $storeProduct['StoreProduct']['id'])); ?>
						    <?php // echo $html->link($html->image('firma/actions_16_up.png',array('title'=>__d('store','Up',true))),  array('plugin'=>'store','controller'=>'products','action'=>'up',$storeProduct['StoreProduct']['id'],'lp_categ','category_id'), array('escape'=>false,'class'=>'')); ?> 
						    <?php // echo $html->link($html->image('firma/actions_16_down.png',array('title'=>__d('store','Down',true))), array('plugin'=>'store','controller'=>'products','action'=>'down',$storeProduct['StoreProduct']['id'],'lp_categ','category_id'), array('escape'=>false,'class'=>'')); ?>						
						</td>
						<?php }?>
					</tr>
				<?php endforeach; ?>
					</table>
					<p>
					<?php
					echo $this->Paginator->counter(array(
					'format' => __d('store','Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
					));
					?>	</p>
				
					<div class="paging">
						<?php echo $this->Paginator->prev('<< ' . __d('store','previous', true), array(), null, array('class'=>'disabled'));?>
					 | 	<?php echo $this->Paginator->numbers();?>
				 |
						<?php echo $this->Paginator->next(__d('store','next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
					</div>
				</div>		
	</div>
</div>

<?php debug($session->read('Store'))?>
<?php if($session->check('Auth.User.id')){?>
<?php echo $this->element('toolbar_actions_main',array('plugin'=>'store','toolbar'=>'product'))?>
<?php }?>
